package com.lhb.mapper;

import com.lhb.pojo.entity.Award;
import com.lhb.pojo.entity.Course;
import com.lhb.pojo.entity.Family;
import com.lhb.pojo.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MainMapper {


    /**
     * 动态获取学生信息
     * @param student
     * @return
     */
    List<Student> getStudents(Student student);

    /**
     * 删除student表所有内容
     */
    @Delete("delete from student")
    void deleteStudent();

    /**
     * 将JTabel内容重写到student表中
     */
    void addStudent(List<Student> studentList);

    /**
     * 动态获得family的数据
     */
    @Select("select * from family where student_id=#{studentId} and #{studentId} IS NOT NULL")
    List<Family> getFamily(Student students);

    /**
     * 删除family表所有内容
     */
    @Delete("delete from family")
    void deleteFamily();

    /**
     * 将JTabel内容重写到family表中
     */
    void addFamily(List<Family> familyList);

    /**
     * 删除award表的所有数据
     */
    @Delete("delete from award")
    void deleteAward();

    /**
     * 动态获取award表中的数据
     * @param student
     * @return
     */

    @Select("select * from award where student_id=#{studentId} and #{studentId} IS NOT NULL")
    List<Award> getAward(Student student);


    /**
     * 将JTabel内容重写到award表中
     */
    void addAward(List<Award> awards);

    /**
     * 动态获取course表的数据
     * @param student
     * @return
     */
    @Select("select * from course where student_id=#{studentId} and #{studentId} IS NOT NULL")
    List<Course> getCourse(Student student);


    /**
     * 删除course表的所有数据
     */
    @Delete("delete from course")
    void deleteCourse();

    /**
     * 将JTabel内容重写到course表中
     * @param courseList
     */
    void addCourse(List<Course> courseList);
}
